"""@package dfa

 
"""

class DFAState:
	name=""
	transitions = None

	def __init__(self, name="", transitions=None):
		self.name=name
		self.transitions=transitions
		if transitions == None:
			self.transitions = {}

class DFATransition:
	_in = ""
	_out = ""
	start = None
	end = None

	def __init__(self, _in, _out, start, end):
		self._in = str(_in)
		self._out = str(_out)
		self.start = start
		self.end = end


class DFA:
	type = ""
	name = ""
	init_state = None
	states = None
	
	def __init__(self, type="dfa", name=""):
		self.type = type
		self.name = name
		self.states = {}
	
	def add_transition(self, start, end, _in, _out):
		trans = DFATransition(_in, _out, self.states[start], self.states[end])
		self.states[start].transitions[_in] = trans

	def add_state(self, name):
		state = DFAState(name)
		self.states[name] = state
	
	def set_init(self, name):
		self.init_state = self.states[name]
	
		
